package com.java.module.system.controller.pc;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.java.common.lang.annotation.ValidateToken;

/**
 * IndexController
 * 
 * @author Administrator
 * @date 2021年8月23日
 */
@Controller("PcIndexController")
@RequestMapping("/")
public class IndexController {

    /**
     * 首页
     */
    @ValidateToken(isValidate = false)
    @GetMapping(value = { "/", "/index.html" })
    public String index(Model model) {
        model.addAttribute("msg", "Hello world.");
        return "index";
    }

    /**
     * 登录
     */
    @ValidateToken(isValidate = false)
    @GetMapping("/login.html")
    public String login(Model model) {
        return "login";
    }

    /**
     * 我的
     */
    @ValidateToken(isValidate = true)
    @GetMapping("/mine.html")
    public String mine(Model model) {
        return "mine";
    }

    /**
     * 接口
     */
    @ValidateToken(isValidate = false)
    @ResponseBody
    @GetMapping("/pc/getIndexData")
    public int getIndexData() {
        return 1;
    }

    /**
     * 接口
     */
    @ValidateToken(isValidate = true)
    @ResponseBody
    @GetMapping("/pc/getUserData")
    public int getUserData() {
        return 2;
    }

}